﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyBlog.Model
{
    public class WordCommentModel
    {
        public int ID { set; get; }

        public int WID { set; get; }

        public string Content { set; get; }

        public DateTime CommentTime { set; get; }

        public string CommentUID { set; get; }

        public string AgreeUsers { set; get; }

        public WordsModel Words { get; set; }

        public int AgreeCount
        {
            get
            {
                if (!string.IsNullOrWhiteSpace(AgreeUsers))
                {
                    if (AgreeUsers.Contains("&"))
                    {
                        return AgreeUsers.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries).Length;
                    }
                    return 1;
                }
                return 0;
            }
        }

    }
}
